package recite.word.service.base.util.common;


import recite.word.service.base.common.exception.ReciteException;

/**
 * @program: l_music
 * @description:
 * @author: Mr.lin
 * @create: 2022-09-02 10:33
 **/

public class Asserts {
	public Asserts(){
	}
	
	public static void isTrue(boolean expression, String message) throws ReciteException {
		if (!expression) {
			throw new ReciteException(message);
		}
	}
	
	public static void isNull(Object data, String message) throws ReciteException {
		if (null != data) {
			throw new ReciteException(message);
		}
	}

	public static void isNotNull(Object data, String message) throws ReciteException {
		if (null == data) {
			throw new ReciteException(message);
		}
	}
	
	public static void isNotBlank(String data, String message) throws ReciteException {
		if (data == null || data.length() == 0) {
			throw new ReciteException(message);
		}
	}

	public static void isLength(String data, int length, String message) throws ReciteException {
		if (data == null || data.length() < length) {
			throw new ReciteException(message);
		}
	}
	
}
